package com.huawei.appgallery.forum.section.impl;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.huawei.appgallery.forum.section.api.IAppDetailSectionProtocol;
import com.huawei.appgallery.forum.section.fragment.ForumSectionDetailFragment;
import com.huawei.appgallery.foundation.ui.css.CSSRule;
import com.huawei.appgallery.foundation.ui.css.CSSSelector;
import com.huawei.appgallery.foundation.ui.css.CSSStyleSheet;
import com.huawei.appgallery.foundation.ui.css.CSSView;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment.b;
import com.huawei.hmf.annotation.FragmentDefine;
import o.bqy;
import o.brd;
import o.cab.e;
import o.cab.i;
import o.ciy;
import o.ciz;
import o.cjb;
import o.ContentManager;
import o.evx;
import o.fjm;

@FragmentDefine(alias = "AppDetailSectionFragment", protocol = IAppDetailSectionProtocol.class)
public class AppDetailSectionFragment extends ForumSectionDetailFragment implements ciz, cjb, ciy {
    private fjm ʻˋ = fjm.ॱ(this);
    private LinearLayout ʼˊ;

    public void ˎ(Bundle bundle) {
        super.ˎ(bundle);
        IAppDetailSectionProtocol iAppDetailSectionProtocol = (IAppDetailSectionProtocol) this.ʻˋ.ॱ();
        this.ˏ = iAppDetailSectionProtocol.getUri();
        this.ˊ = iAppDetailSectionProtocol.getFragmentID();
        this.ﾟ = iAppDetailSectionProtocol.getStyle();
        this.ﹳ = iAppDetailSectionProtocol.getCss();
        this.ʹ = iAppDetailSectionProtocol.getCssSelector();
        this.ʼˋ = iAppDetailSectionProtocol.getAppId();
        this.ʻˊ = iAppDetailSectionProtocol.getDomainId();
    }

    public void ʼᐝ() {
        if (this.ॱ != null) {
            super.ʼᐝ();
            this.ॱ.setImmerse(false);
        }
    }

    public boolean ad_() {
        if (this.ॱ != null) {
            return this.ॱ.ˎ();
        }
        return false;
    }

    public void ˎ(ViewGroup viewGroup) {
    }

    public boolean ˋ(LinearLayout linearLayout) {
        if (linearLayout == null) {
            return false;
        }
        if (this.ʼˊ == null || this.ʼˊ != linearLayout) {
            this.ʼˊ = linearLayout;
            this.ˋ = (ImageView) LayoutInflater.from(ContentManager.getInstant().getContext()).inflate(i.ˎ, linearLayout).findViewById(e.ㆍ);
            this.ˋ.setOnClickListener(new evx(this) {
                final /* synthetic */ AppDetailSectionFragment ॱ;

                {
                    this.ॱ = r1;
                }

                public void ˋ(View view) {
                    this.ॱ.ˊʼ();
                }
            });
        }
        if (this.ʽ != null) {
            ᐝ(0);
        }
        ˉॱ();
        return true;
    }

    public void ˋ(int i) {
    }

    public void ʽˊ() {
    }

    public void ʾॱ() {
    }

    public boolean ˋ(TaskFragment taskFragment, b bVar) {
        boolean ˋ = super.ˋ(taskFragment, bVar);
        ˉॱ();
        return ˋ;
    }

    public void ᐝ(int i) {
        if (this.ˋ != null) {
            this.ˋ.setVisibility(i);
        }
    }

    private void ॱ(View view) {
        if (this.ﹳ != null && this.ʹ != null && view != null) {
            CSSSelector cSSSelector = new CSSSelector(this.ʹ);
            CSSStyleSheet parse = CSSStyleSheet.parse(this.ﹳ);
            if (parse != null) {
                CSSRule rule = cSSSelector.getRule(parse.getRootRule());
                if (rule != null) {
                    CSSView.wrap(view, rule).render();
                }
            }
        }
    }

    public void ˋ(View view) {
        if (view != null && this.ﾟ == 1) {
            ॱ(view);
        }
    }

    private void ˉॱ() {
        if (!TextUtils.isEmpty(this.ʻˊ) && !TextUtils.isEmpty(this.ˏ)) {
            brd.ॱ.ˏ(bqy.ˋ().ˎ(ॱˋ()), this.ʻˊ, this.ˏ);
        }
    }
}
